<?php 
include_once('Filters.php');
$fil=new Filter();
$Company=$fil->getCarCompany();
$BodyStyle=$fil->getBodyStyle();
$Transmission=$fil->getTransmission();
$DriverTrain=$fil->getDriverTrain();
$InteriorColor=$fil->getInteriorColor();
$ExteriorColor=$fil->getExteriorColor();
$fuelType=$fil->getFuelType();
$CityMiles=$fil->getCityMiles();
$HighWayMiles=$fil->getHighWayMiles();
$queryString=(isset($_GET['App']))?'&':'?';
				
	

?>

<html>
<head>

<script src="JS/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="JS/jquery.tabify.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var j=0;
function changeID(id)
	{
		$('#'+id).attr('id','fil'+j);
		$('#fil'+j).css('font-size','12px');
		j++;
		
	}
	function changeURL(cond)
	{
		var ur=document.URL;
		ur=ur.replace(cond,"None");
		window.location=ur;
	}
</script>
<style type="text/css">
#searchcondition
{
    font-weight:normal;
    font-size:10px;
    color:#ffffff;
    text-decoration:underline;   
}
#showcase{
   
    text-decoration:underline;
}
hr{
    background-color:#171717;
   border: 0.3 px solid #54554d;
}
#condition{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_1{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;
}
#condition2{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_2{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;


}
#condition3{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_3{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;


}
#condition4{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_4{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;


}
#condition5{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_5{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;


}
#condition6{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_6{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;
}
#condition7{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_7{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;
}
#condition8{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_8{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;
}
#condition9{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_9{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;
}
#condition10{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_10{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;
}
#condition11{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_11{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;
}
#condition12{
    white-space: normal;
font-family: arial,helvetica;
font-size:12px;
}
#filter_12{
    white-space: normal;
font-family: arial,helvetica;
font-size: 12px;


}
#close{
     background-image:url("images/close1.png");
}
</style>
</head>

<body>

<div id="left-nav">
   
    
    <div id="showcase"><br>
      
        <h3>Refine Your Search By:</h3>
        <table border="0">
        	<tr>
        		<td>
        			
        		</td>
        	</tr>
        </table>    
    </div>
</br>
        <br>
<table border="0" id="showcase" style="background-color:#4b4c47">
     <tr align="left">
         <td align="left" id="searchfilter">
            </td>
            <td align="left" id="filter">
             <span id="filter_1" style="cursor:pointer">Condition</span>
            </td>
        </tr>
        <tr>
            <td></td>
    <td align="left" id="condition" style="display:none">
    <?php
    $isCondition=0;
				if(!stristr($_SERVER['REQUEST_URI'],"?Condition=")==FALSE){
					
					$url=explode("?Condition=",$_SERVER['REQUEST_URI']);
					$isCondition=1;
					
				}
				else
				{
					if(!stristr($_SERVER['REQUEST_URI'],"&Condition=")==FALSE){
					
					$url=explode("&Condition=",$_SERVER['REQUEST_URI']);
					$isCondition=1;
					
					}
				}
				?>
                 <a href="<?php if($isCondition==1){echo $url[0].'?';}else{
				 echo $_SERVER['PHP_SELF'].'?';}?>Condition=Used&App">Used(<?php echo $fil->CountUsedCars();?>)</a></br>
                 <a href="<?php if($isCondition==1){echo $url[0].'?';}else{ echo $_SERVER['PHP_SELF'].'?';}?>Condition=New&App">New(<?php echo $fil->CountNewCars();?>)</a>
                </td> 
                <?php if(isset($_GET['Condition']) && $_GET['Condition']!="None"){?>
                <td><?php echo $_GET['Condition']?></td>  
               <td> <a href="javascript:void(0)" onClick="changeURL('<?php echo $_GET['Condition'] ?>')"><strong style="float:right;margin-left: 90px">X</strong></a></td>
               
                <?php echo '<script type="text/javascript">
				changeID("filter_1");
				</script>';}?>
         </tr>                   
</table>
<hr></hr>       
<br>
<table border="0" id="showcase">
     <tr align="left">
         <td align="left" id="searchfilter2">
            </td>
            <td align="left" id="filter">
             <span id="filter_2" style="cursor:pointer">Make</span>
            </td>
        </tr>
        <tr>
            <td></td>
    			<td align="left" id="condition2" style="display:none">
               
                
                <?php foreach($Company as $key => $CompanyName){?>
                <?php
				$isMake=0;
				$isMake_1=0;
				if(!stristr($_SERVER['REQUEST_URI'],"?Make=")==FALSE){
					
					$url=explode("?Make=",$_SERVER['REQUEST_URI']);
					$isMake=1;
				}
				else
				{
					if(!stristr($_SERVER['REQUEST_URI'],"&Make=")==FALSE){
					
					$url=explode("&Make=",$_SERVER['REQUEST_URI']);
					$isMake_1=1;
					}
				}
				
				?>
                 <a href="<?php  if($isMake==1){echo $url[0].'?';}else if($isMake_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>Make=<?php echo base64_encode($CompanyName[1])?>&App"><?php if($CompanyName[1]==""){"(".$fil->CountOther('MAKE',$CompanyName[1]).")";}else {echo $CompanyName[1]."(".$fil->CountOther('MAKE',$CompanyName[1]).")";}?></a></br>
                 
				<?php } ?>
                </td>  
                 <?php if(isset($_GET['Make']) && $_GET['Make']!="None"){?>
                <td><?php echo base64_decode($_GET['Make'])?></td>  
               <td> <a href="javascript:void(0)" onClick="changeURL('<?php echo $_GET['Make'] ?>')"><strong style="float:right;margin-left: 90px">X</strong></a></td>              
               
                <?php echo '<script type="text/javascript">
				changeID("filter_2");
				</script>';}?>              
         </tr>                   
</table>
<hr></hr>
<br>
<table border="0" id="showcase">
     <tr align="left">
         <td align="left" id="searchfilter3">
            </td>
            <td align="left" id="filter">
             <span id="filter_3" style="cursor:pointer">Body Style</span>
            </td>
        </tr>
        <tr>
            <td></td>
    			<td align="left" id="condition3" style="display:none">
                 <?php foreach($BodyStyle as $key => $CarBody){?>
                <?php
				$isStyle=0;
				$isStyle_1=0;
				if(!stristr($_SERVER['REQUEST_URI'],"?Style=")==FALSE){
					
					$url=explode("?Style=",$_SERVER['REQUEST_URI']);
					$isStyle=1;
				}
				else
				{
					if(!stristr($_SERVER['REQUEST_URI'],"&Style=")==FALSE){
					
					$url=explode("&Style=",$_SERVER['REQUEST_URI']);
					$isStyle_1=1;
					}
				}
				
				?>
                 <a href="<?php  if($isStyle==1){echo $url[0].'?';}else if($isStyle_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString;; }?>Style=<?php echo base64_encode($CarBody[1])?>&App"><?php if($CarBody[1]==""){"(".$fil->CountOther('BODY_STYLE',$CarBody[1]).")"; }else{echo $CarBody[1]."(".$fil->CountOther('BODY_STYLE',$CarBody[1]).")";}?></a></br>
                 
				<?php } ?>

                </td>
                </td>  
                 <?php if(isset($_GET['Style']) && $_GET['Style']!="None"){?>
                <td><?php echo base64_decode($_GET['Style'])?></td>  
               <td> <a href="javascript:void(0)" onClick="changeURL('<?php echo $_GET['Style'] ?>')"><strong style="float:right;margin-left: 90px">X</strong></a></td>              
               
                <?php echo '<script type="text/javascript">
				changeID("filter_3");
				</script>';}?>   
         </tr>
</table>
<hr>
<br>
<table border="0" id="showcase">
     <tr align="left">
         <td align="left" id="searchfilter4">
            </td>
            <td align="left" id="filter">
             <span id="filter_4" style="cursor:pointer">Year</span>
            </td>
        </tr>
        <tr>
            <td></td>
<!--            <td align="left" id="condition4" style="display:none">-->
                                
				<td align="right" id="condition4" style="display:none">
                       <form action="" method="post">    
                           <select name="start_year">
					
					<option value="1990">1990</option>
					<option value="1991">1991</option>
					<option value="1992">1992</option>
					<option value="1993">1993</option>
					<option value="1994">1994</option>
					<option value="1995">1995</option>
					<option value="1996">1996</option>
					<option value="1997">1997</option>
					<option value="1998">1998</option>
					<option value="1999">1999</option>
					<option value="2000">2000</option>
					<option value="2001">2001</option>
					<option value="2002">2002</option>
					<option value="2003">2003</option>
					<option value="2004">2004</option>
					<option value="2005">2005</option>
					<option value="2006">2006</option>
					<option value="2007">2007</option>
					<option value="2008">2008</option>
					<option value="2009">2009</option>
					<option value="2010">2010</option>
					<option value="2011">2011</option>
					<option value="2012">2012</option>
					<option value="2013">2013</option>
					<option value="2014">2014</option>
					<option value="2015">2015</option>
					<option value="2016">2016</option>
					<option value="2017">2017</option>
					<option value="2018">2018</option>
					<option value="2019">2019</option>
					<option value="2020">2020</option>					
					</select>

                    <select name="end_year">
					<option value="1990">1990</option>
					<option value="1991">1991</option>
					<option value="1992">1992</option>
					<option value="1993">1993</option>
					<option value="1994">1994</option>
					<option value="1995">1995</option>
					<option value="1996">1996</option>
					<option value="1997">1997</option>
					<option value="1998">1998</option>
					<option value="1999">1999</option>
					<option value="2000">2000</option>
					<option value="2001">2001</option>
					<option value="2002">2002</option>
					<option value="2003">2003</option>
					<option value="2004">2004</option>
					<option value="2005">2005</option>
					<option value="2006">2006</option>
					<option value="2007">2007</option>
					<option value="2008">2008</option>
					<option value="2009">2009</option>
					<option value="2010">2010</option>
					<option value="2011">2011</option>
					<option value="2012">2012</option>
					<option value="2013">2013</option>
					<option value="2014">2014</option>
					<option value="2015">2015</option>
					<option value="2016">2016</option>
					<option value="2017">2017</option>
					<option value="2018">2018</option>
					<option value="2019">2019</option>
					<option value="2020">2020</option>
                                        </select><br>
                                        <input type="submit" value="submit" name="Year">
                                        </form>

                                </td>
                                </tr>
                            </table>

<hr>
<br>
<table border="0" id="showcase">
     <tr align="left">
         <td align="left" id="searchfilter5">
            </td>
            <td align="left" id="filter">
             <span id="filter_5" style="cursor:pointer">Odometer</span>
            </td>
        </tr>
        <tr>
            <td></td>
    			<td align="left" id="condition5" style="display:none">
                 <?php
				$Mileage=0;
				$Mileage_1=0;
				if(!stristr($_SERVER['REQUEST_URI'],"?Mileage=")==FALSE){
					
					$url=explode("?Mileage=",$_SERVER['REQUEST_URI']);
					$Mileage=0;
				}
				else
				{
					if(!stristr($_SERVER['REQUEST_URI'],"&Mileage=")==FALSE){
					
					$url=explode("&Mileage=",$_SERVER['REQUEST_URI']);
					$Mileage_1=0;
					}
				}
				
				?>
                 <a href="<?php  if($Mileage==1){echo $url[0].'?';}else if($Mileage_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>Mileage=10&App">Less than 10<?php echo "(".$fil->CountOther('MILEAGE',10).")";?></a></br>
                  <a href="<?php  if($Mileage==1){echo $url[0].'?';}else if($Mileage_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>Mileage=20&App">Less than 20<?php echo "(".$fil->CountOther('MILEAGE',20).")";?></a></br>
                   <a href="<?php  if($Mileage==1){echo $url[0].'?';}else if($Mileage_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>Mileage=40&App">Less than 40<?php echo "(".$fil->CountOther('MILEAGE',40).")";?></a></br>
                    <a href="<?php  if($Mileage==1){echo $url[0].'?';}else if($Mileage_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>Mileage=60&App">Less than 60<?php echo "(".$fil->CountOther('MILEAGE',60).")";?></a></br>
                 
                 
                </td>
                <?php if(isset($_GET['Mileage']) && $_GET['Mileage']!="None"){?>
                <td><?php echo $_GET['Mileage'];?></td>  
               <td> <a href="javascript:void(0)" onClick="changeURL('<?php echo $_GET['Mileage'] ?>')"><strong style="float:right;margin-left: 90px">X</strong></a></td>              
               
                <?php echo '<script type="text/javascript">
				changeID("filter_5");
				</script>';}?>   
         </tr>
</table>
<hr>
<br>
<table border="0" id="showcase">
     <tr align="left">
         <td align="left" id="searchfilter6">
            </td>
            <td align="left" id="filter">
             <span id="filter_6" style="cursor:pointer">Transmission</span>
            </td>
        </tr>
        <tr>
            <td></td>
    			<td align="left" id="condition6" style="display:none">
                <?php 
				
				foreach($Transmission as $key1 => $Trans){
                $Tran=0;
				$Tran_1=0;
				if(!stristr($_SERVER['REQUEST_URI'],"?Trans=")==FALSE){
					
					$url=explode("?Trans=",$_SERVER['REQUEST_URI']);
					$Tran=1;
				}
				else
				{
					if(!stristr($_SERVER['REQUEST_URI'],"&Trans=")==FALSE){
					
					$url=explode("&Trans=",$_SERVER['REQUEST_URI']);
					$Tran_1=1;
					}
				}?>
                  <a href="<?php  if($Tran==1){echo $url[0].'?';}else if($Tran_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>Trans=<?php echo base64_encode($Trans[1]);?>&App"><?php if($Trans[1]==""){"(".$fil->CountOther('TRANSMISSION',$Trans[1]).")";} else {echo $Trans[1]."(".$fil->CountOther('TRANSMISSION',$Trans[1]).")";}?></a></br>
                 
              <?php }  ?>
                </td>
                                <?php if(isset($_GET['Trans']) && $_GET['Trans']!="None"){?>
                <td><?php echo base64_decode($_GET['Trans'])?></td>  
               <td> <a href="javascript:void(0)" onClick="changeURL('<?php echo $_GET['Trans'] ?>')"><strong style="float:right;margin-left: 90px">X</strong></a></td>              
               
                <?php echo '<script type="text/javascript">
				changeID("filter_6");
				</script>';}?>   

         </tr>
</table>
<hr>
<br>
<table border="0" id="showcase">
     <tr align="left">
         <td align="left" id="searchfilter7">
            </td>
            <td align="left" id="filter">
             <span id="filter_7" style="cursor:pointer">Drivertrain</span>
            </td>
        </tr>
        <tr>
            <td></td>
    			<td align="left" id="condition7" style="display:none">
                 <?php 
				
				foreach($DriverTrain as $key1 => $DTrain){
                $Train=0;
				$Train_1=0;
				if(!stristr($_SERVER['REQUEST_URI'],"?DTrain=")==FALSE){
					
					$url=explode("?DTrain=",$_SERVER['REQUEST_URI']);
					$Train=1;
				}
				else
				{
					if(!stristr($_SERVER['REQUEST_URI'],"&DTrain=")==FALSE){
					
					$url=explode("&DTrain=",$_SERVER['REQUEST_URI']);
					$Train_1=1;
					}
				}?>
                  <a href="<?php  if($Train==1){echo $url[0].'?';}else if($Train_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>DTrain=<?php echo base64_encode($DTrain[1]);?>&App"><?php if($DTrain[1]==""){"(".$fil->CountOther('DRIVE_TRAIN',$DTrain[1]).")";}else{echo $DTrain[1]."(".$fil->CountOther('DRIVE_TRAIN',$DTrain[1]).")";}?></a></br>
                 
              <?php }  ?>
                </td>
                 <?php if(isset($_GET['DTrain']) && $_GET['DTrain']!="None"){?>
                <td><?php echo base64_decode($_GET['DTrain'])?></td>  
               <td> <a href="javascript:void(0)" onClick="changeURL('<?php echo $_GET['DTrain'] ?>')"><strong style="float:right;margin-left: 90px">X</strong></a></td>              
               
                <?php echo '<script type="text/javascript">
				changeID("filter_7");
				</script>';}?>   

         </tr>
</table>
<hr>
<br>
<table border="0" id="showcase">
     <tr align="left">
         <td align="left" id="searchfilter8">
            </td>
            <td align="left" id="filter">
             <span id="filter_8" style="cursor:pointer">Exterior Color</span>
            </td>
        </tr>
        <tr>
            <td></td>
    			<td align="left" id="condition8" style="display:none">
                <?php
                foreach($ExteriorColor as $key1 => $ExtColor){
                $ExtC=0;
				$ExtC_1=0;
				if(!stristr($_SERVER['REQUEST_URI'],"?ExtColor=")==FALSE){
					
					$url=explode("?ExtColor=",$_SERVER['REQUEST_URI']);
					$ExtC=1;
				}
				else
				{
					if(!stristr($_SERVER['REQUEST_URI'],"&ExtColor=")==FALSE){
					
					$url=explode("&ExtColor=",$_SERVER['REQUEST_URI']);
					$ExtC_1=1;
					}
				}?>
                  <a href="<?php  if($ExtC==1){echo $url[0].'?';}else if($ExtC_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>ExtColor=<?php echo base64_encode($ExtColor[1]);?>&App"><?php if($ExtColor[1]==""){"(".$fil->CountOther('EXTERIOR_COLOR',$ExtColor[1]).")";}else{echo $ExtColor[1]."(".$fil->CountOther('EXTERIOR_COLOR',$ExtColor[1]).")";}?></a></br>
                 
              <?php }  ?>
                </td>
                 <?php if(isset($_GET['ExtColor']) && $_GET['ExtColor']!="None"){?>
                <td><?php echo base64_decode($_GET['ExtColor'])?></td>  
               <td> <a href="javascript:void(0)" onClick="changeURL('<?php echo $_GET['ExtColor'] ?>')"><strong style="float:right;margin-left: 90px">X</strong></a></td>              
               
                <?php echo '<script type="text/javascript">
				changeID("filter_8");
				</script>';}?>   
         </tr>
</table>
<hr>
<br>
<table border="0" id="showcase">
     <tr align="left">
         <td align="left" id="searchfilter9">
            </td>
            <td align="left" id="filter">
             <span id="filter_9"style="cursor:pointer">Interior Color</span>
            </td>
        </tr>
        <tr>
            <td></td>
    			<td align="left" id="condition9" style="display:none">
                 <?php
                foreach($InteriorColor as $key1 => $IntColor){
                $IntC=0;
				 $IntC_1=0;
				if(!stristr($_SERVER['REQUEST_URI'],"?IntColor=")==FALSE){
					
					$url=explode("?IntColor=",$_SERVER['REQUEST_URI']);
					$IntC=1;
				}
				else
				{
					if(!stristr($_SERVER['REQUEST_URI'],"&IntColor=")==FALSE){
					
					$url=explode("&IntColor=",$_SERVER['REQUEST_URI']);
					$IntC_1=1;
					}
				}?>
                  <a href="<?php  if($IntC==1){echo $url[0].'?';}else if($IntC_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>IntColor=<?php echo base64_encode($IntColor[1]);?>&App"><?php if($IntColor[1]==""){"(".$fil->CountOther('INTERIOR_COLOR',$IntColor[1]).")";}else{echo $IntColor[1]."(".$fil->CountOther('INTERIOR_COLOR',$IntColor[1]).")";}?></a></br>
                 
              <?php }  ?>
                </td>
                <?php if(isset($_GET['IntColor']) && $_GET['IntColor']!="None"){?>
                <td><?php echo base64_decode($_GET['IntColor'])?></td>  
               <td> <a href="javascript:void(0)" onClick="changeURL('<?php echo $_GET['IntColor'] ?>')"><strong style="float:right;margin-left: 90px">X</strong></a></td>              
               
                <?php echo '<script type="text/javascript">
				changeID("filter_9");
				</script>';}?>   
         </tr>
</table>
<hr>
<br>
<table border="0" id="showcase">
     <tr align="left">
         <td align="left" id="searchfilter10">
            </td>
            <td align="left" id="filter">
             <span id="filter_10" style="cursor:pointer">Fuel</span>
            </td>
        </tr>
        <tr>
            <td></td>
    			<td align="left" id="condition10" style="display:none">

                <?php
                foreach($fuelType as $key1 => $Fuel){
                $fuelT=0;
				  $fuelT_1=0;
				if(!stristr($_SERVER['REQUEST_URI'],"?FuelType=")==FALSE){
					
					$url=explode("?FuelType=",$_SERVER['REQUEST_URI']);
					$fuelT=1;
				}
				else
				{
					if(!stristr($_SERVER['REQUEST_URI'],"&FuelType=")==FALSE){
					
					$url=explode("&FuelType=",$_SERVER['REQUEST_URI']);
					 $fuelT_1=1;
					}
				}?>
                  <a href="<?php  if($fuelT==1){echo $url[0].'?';}else if($fuelT_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>FuelType=<?php echo base64_encode($Fuel[1]);?>&App"><?php if($Fuel[1]==""){"(".$fil->CountOther('FUEL_TYPE',$Fuel[1]).")";}else{ echo $Fuel[1]."(".$fil->CountOther('FUEL_TYPE',$Fuel[1]).")";}?></a></br>
                 
              <?php }  ?>
                </td>
                <?php if(isset($_GET['FuelType']) && $_GET['FuelType']!="None"){?>
                <td><?php echo base64_decode($_GET['FuelType'])?></td>  
               <td> <a href="javascript:void(0)" onClick="changeURL('<?php echo $_GET['FuelType'] ?>')"><strong style="float:right;margin-left: 90px">X</strong></a></td>              
               
                <?php echo '<script type="text/javascript">
				changeID("filter_10");
				</script>';}?>  
         </tr>
</table>
<hr>
<br>
<table border="0" id="showcase">
     <tr align="left">
         <td align="left" id="searchfilter11">
            </td>
            <td align="left" id="filter">
             <span id="filter_11" style="cursor:pointer">City Miles\Gallon</span>
            </td>
        </tr>
        <tr>
            <td></td>
    			<td align="left" id="condition11" style="display:none">
 <?php
                
                $CityM=0;
				 $CityM_1=0;
				if(!stristr($_SERVER['REQUEST_URI'],"?CityMiles=")==FALSE){
					
					$url=explode("?CityMiles=",$_SERVER['REQUEST_URI']);
					$CityM=1;
				}
				else
				{
					if(!stristr($_SERVER['REQUEST_URI'],"&CityMiles=")==FALSE){
					
					$url=explode("&CityMiles=",$_SERVER['REQUEST_URI']);
					  $CityM_1=1;
					}
				}?>
                  <a href="<?php  if( $CityM==1){echo $url[0].'?';}else if( $CityM_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>CityMiles=10&App">Over 10 MPG City<?php echo "(".$fil->CountOther('CITY_MILES_PER_GALLON',10).")";?></a></br>
                 <a href="<?php  if( $CityM==1){echo $url[0].'?';}else if( $CityM_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>CityMiles=15&App">Over 15 MPG City<?php echo "(".$fil->CountOther('CITY_MILES_PER_GALLON',15).")";?></a></br>
                 <a href="<?php  if( $CityM==1){echo $url[0].'?';}else if( $CityM_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>CityMiles=20&App">Over 20 MPG City<?php echo "(".$fil->CountOther('CITY_MILES_PER_GALLON',20).")";?></a></br>
                 <a href="<?php  if( $CityM==1){echo $url[0].'?';}else if( $CityM_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>CityMiles=25&App">Over 25 MPG City<?php echo "(".$fil->CountOther('CITY_MILES_PER_GALLON',25).")";?></a></br>
                 
              <?php  ?>

               
                </td>
                <?php if(isset($_GET['CityMiles']) && $_GET['CityMiles']!="None"){?>
                <td><?php echo $_GET['CityMiles'];?></td>  
               <td> <a href="javascript:void(0)" onClick="changeURL('<?php echo $_GET['CityMiles'] ?>')"><strong style="float:right;margin-left: 90px">X</strong></a></td>              
               
                <?php echo '<script type="text/javascript">
				changeID("filter_11");
				</script>';}?>  
         </tr>
</table>
<hr>
<br>
<table border="0" id="showcase">
     <tr align="left">
         <td align="left" id="searchfilter12">
            </td>
            <td align="left" id="filter">
             <span id="filter_12" style="cursor:pointer">High Way Miles\Gallon</span>
            </td>
        </tr>
        <tr>
            <td></td>
    			<td align="left" id="condition12" style="display:none">
                 <?php
              
                $HighM=0;
				 $HighM_1=0;
				if(!stristr($_SERVER['REQUEST_URI'],"?HighWayMiles=")==FALSE){
					
					$url=explode("?HighWayMiles=",$_SERVER['REQUEST_URI']);
					$HighM=1;
				}
				else
				{
					if(!stristr($_SERVER['REQUEST_URI'],"&HighWayMiles=")==FALSE){
					
					$url=explode("&HighWayMiles=",$_SERVER['REQUEST_URI']);
					   $HighM_1=1;
					}
				}?>
                  <a href="<?php  if(  $HighM==1){echo $url[0].'?';}else if(  $HighM_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>HighWayMiles=15&App">Over 15 MPG HWY<?php echo "(".$fil->CountOther('HIGHWAY_MILES_PER_GALLON',15).")";?></a></br>
                   <a href="<?php  if(  $HighM==1){echo $url[0].'?';}else if(  $HighM_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>HighWayMiles=20&App">Over 20 MPG HWY<?php echo "(".$fil->CountOther('HIGHWAY_MILES_PER_GALLON',20).")";?></a></br>
                    <a href="<?php  if(  $HighM==1){echo $url[0].'?';}else if(  $HighM_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>HighWayMiles=25&App">Over 25 MPG HWY<?php echo "(".$fil->CountOther('HIGHWAY_MILES_PER_GALLON',25).")";?></a></br>
                     <a href="<?php  if(  $HighM==1){echo $url[0].'?';}else if(  $HighM_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>HighWayMiles=30&App">Over 30 MPG HWY<?php echo "(".$fil->CountOther('HIGHWAY_MILES_PER_GALLON',30).")";?></a></br>
                      <a href="<?php  if(  $HighM==1){echo $url[0].'?';}else if(  $HighM_1==1){echo $url[0].'&';}else{echo $_SERVER['REQUEST_URI'].$queryString; }?>HighWayMiles=35&App">Over 35 MPG HWY<?php echo "(".$fil->CountOther('HIGHWAY_MILES_PER_GALLON',35).")";?></a></br>
                 
              <?php  ?>

                 
                </td>
                 <?php if(isset($_GET['HighWayMiles']) && $_GET['HighWayMiles']!="None"){?>
                <td><?php echo $_GET['HighWayMiles'];?></td>  
               <td> <a href="javascript:void(0)" onClick="changeURL('<?php echo $_GET['HighWayMiles'] ?>')"><strong style="float:right;margin-left: 90px">X</strong></a></td>              
               
                <?php echo '<script type="text/javascript">
				changeID("filter_12");
				</script>';}?> 
         </tr>
</table>
<hr>

</div>
</body>
</html>

<script type="text/javascript">
var bit=0;
var bit_1=0;
var bit_2=0;
var bit_3=0;
var bit_4=0;
var bit_5=0;
var bit_6=0;
var bit_7=0;
var bit_8=0;
var bit_9=0;
var bit_10=0;
var bit_11=0;
$(document).find("[id^='filter_1'],[id^='searchfilter']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_1" || toggle=="searchfilter")
        {
	    	if (bit==0)
		    	{
		            $('#searchfilter').css('background', 'url("images/downarrow.jpg")');
		            $("#condition").toggle();
		            bit=bit+1;
		    	}else
			    	if(bit==1)
				    	{
            				$('#searchfilter').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition").toggle();
            				bit=0;
		    			}  
    	}	
    });

$(document).find("[id^='filter_2'],[id^='searchfilter2']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_2" || toggle=="searchfilter2")
        {
	    	if (bit_1==0)
		    	{
		            $('#searchfilter2').css('background', 'url("images/downarrow.jpg")');
		            $("#condition2").toggle();
		            bit_1=bit_1+1;
		    	}else
			    	if(bit_1==1)
				    	{
            				$('#searchfilter2').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition2").toggle();
            				bit_1=0;
		    			}  
    	}	
    });

    $(document).find("[id^='filter_3'],[id^='searchfilter3']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_3" || toggle=="searchfilter3")
        {
	    	if (bit_2==0)
		    	{
		            $('#searchfilter3').css('background', 'url("images/downarrow.jpg")');
		            $("#condition3").toggle();
		            bit_2=bit_2+1;
		    	}else
			    	if(bit_2==1)
				    	{
            				$('#searchfilter3').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition3").toggle();
            				bit_2=0;
		    			}
    	}
    });
     $(document).find("[id^='filter_4'],[id^='searchfilter4']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_4" || toggle=="searchfilter4")
        {
	    	if (bit_3==0)
		    	{
		            $('#searchfilter4').css('background', 'url("images/downarrow.jpg")');
		            $("#condition4").toggle();
		            bit_3=bit_3+1;
		    	}else
			    	if(bit_3==1)
				    	{
            				$('#searchfilter4').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition4").toggle();
            				bit_3=0;
		    			}
    	}
    });
     $(document).find("[id^='filter_5'],[id^='searchfilter5']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_5" || toggle=="searchfilter5")
        {
	    	if (bit_4==0)
		    	{
		            $('#searchfilter5').css('background', 'url("images/downarrow.jpg")');
		            $("#condition5").toggle();
		            bit_4=bit_4+1;
		    	}else
			    	if(bit_4==1)
				    	{
            				$('#searchfilter5').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition5").toggle();
            				bit_4=0;
		    			}
    	}
    });
     $(document).find("[id^='filter_6'],[id^='searchfilter6']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_6" || toggle=="searchfilter6")
        {
	    	if (bit_5==0)
		    	{
		            $('#searchfilter6').css('background', 'url("images/downarrow.jpg")');
		            $("#condition6").toggle();
		            bit_5=bit_5+1;
		    	}else
			    	if(bit_5==1)
				    	{
            				$('#searchfilter6').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition6").toggle();
            				bit_5=0;
		    			}
    	}
    });
      $(document).find("[id^='filter_7'],[id^='searchfilter7']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_7" || toggle=="searchfilter7")
        {
	    	if (bit_6==0)
		    	{
		            $('#searchfilter7').css('background', 'url("images/downarrow.jpg")');
		            $("#condition7").toggle();
		            bit_6=bit_6+1;
		    	}else
			    	if(bit_6==1)
				    	{
            				$('#searchfilter7').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition7").toggle();
            				bit_6=0;
		    			}
    	}
    });
     $(document).find("[id^='filter_8'],[id^='searchfilter8']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_8" || toggle=="searchfilter8")
        {
	    	if (bit_7==0)
		    	{
		            $('#searchfilter8').css('background', 'url("images/downarrow.jpg")');
		            $("#condition8").toggle();
		            bit_7=bit_7+1;
		    	}else
			    	if(bit_7==1)
				    	{
            				$('#searchfilter8').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition8").toggle();
            				bit_7=0;
		    			}
    	}
    });
     $(document).find("[id^='filter_9'],[id^='searchfilter9']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_9" || toggle=="searchfilter9")
        {
	    	if (bit_8==0)
		    	{
		            $('#searchfilter9').css('background', 'url("images/downarrow.jpg")');
		            $("#condition9").toggle();
		            bit_8=bit_8+1;
		    	}else
			    	if(bit_8==1)
				    	{
            				$('#searchfilter9').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition9").toggle();
            				bit_8=0;
		    			}
    	}
    });
 $(document).find("[id^='filter_10'],[id^='searchfilter10']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_10" || toggle=="searchfilter10")
        {
	    	if (bit_9==0)
		    	{
		            $('#searchfilter10').css('background', 'url("images/downarrow.jpg")');
		            $("#condition10").toggle();
		            bit_9=bit_9+1;
		    	}else
			    	if(bit_9==1)
				    	{
            				$('#searchfilter10').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition10").toggle();
            				bit_9=0;
		    			}
    	}
    });
    $(document).find("[id^='filter_11'],[id^='searchfilter11']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_11" || toggle=="searchfilter11")
        {
	    	if (bit_10==0)
		    	{
		            $('#searchfilter11').css('background', 'url("images/downarrow.jpg")');
		            $("#condition11").toggle();
		            bit_10=bit_10+1;
		    	}else
			    	if(bit_10==1)
				    	{
            				$('#searchfilter11').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition11").toggle();
            				bit_10=0;
		    			}
    	}
    });
     $(document).find("[id^='filter_12'],[id^='searchfilter12']").live("click",function(){
    var toggle=this.id;
    if(toggle=="filter_12" || toggle=="searchfilter12")
        {
	    	if (bit_11==0)
		    	{
		            $('#searchfilter12').css('background', 'url("images/downarrow.jpg")');
		            $("#condition12").toggle();
		            bit_11=bit_11+1;
		    	}else
			    	if(bit_11==1)
				    	{
            				$('#searchfilter12').css('background', 'url("images/rightarrow.jpg")');
            				$("#condition12").toggle();
            				bit_11=0;
		    			}
    	}
    });
	
	

</script>